import Vue from 'vue'
import VueRouter from 'vue-router';
import mainRouter from './main.route';
import companyRouter from './company.route';
import userRouter from './user.route';
import detailRouter from './detail.route.js';

Vue.use(VueRouter)  //注册 VueRouter 组件
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
export default new VueRouter({
  routes: [
    {
      path: '/',
      redirect:'/index',  //重定向路径
      meta: {
        title: '嗨崖hi-ya'
      }
    },{
      path: '/',
      component: () => import('@/layouts/main'),
      children: [
        ...mainRouter
      ]
    },{
      path: '/',
      component: () => import('@/layouts/company_center'),
      children: [
        ...companyRouter
      ]
    },{
      path: '/',
      component: () => import('@/layouts/user_center'),
      children: [
        ...userRouter
      ]
    },{
      path: '/',
      component: () => import('@/layouts/detail'),
      children: [
        ...detailRouter
      ]
    },{
      path: '/login',
      name: 'login',
      component:  () => import('@/pages/public/login')
    },{
      path: '/forget',
      name: 'forget',
      component:  () => import('@/pages/public/forget')
    },{
      path: '/register',
      name: 'register',
      component:  () => import('@/pages/public/register')
    }
	
  ]
})